package com.itheima.treesetdemo;

import java.util.TreeSet;

/**
 * Tree 集合存储Student类型
 */
public class TreeSetDemo5 {
    public static void main(String[] args) {
        TreeSet<String> ts = new TreeSet<>((s1,s2) -> {
            int result = s1.length() - s2.length();
            result = (result == 0) ? s1.compareTo(s2) : result;
            return result;
        });
        ts.add("ab");
        ts.add("c");
        ts.add("qwer");
        ts.add("df");

        for (String t : ts) {
            System.out.println(t);

        }
    }
}
